# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=google-cloud-storage
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.38.0
pkgrel=2
pkgdesc='Google Cloud Storage API client library (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/googleapis/python-storage"
license=('Apache-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-python-google-cloud-core" "${MINGW_PACKAGE_PREFIX}-python-google-resumable-media")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('!emptydirs')
source=("${_realname}-$pkgver.tar.gz::https://github.com/googleapis/python-storage/archive/v$pkgver.tar.gz")
sha256sums=('50e969ba86284b3a58b85c8d445fe8259ab45e00bdde01c565d7aa9b0f0b5a37')

prepare() {  
  cd "$srcdir"
  rm -rf python-build-${CARCH} | true
  cp -r "python-storage-${pkgver}" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"  
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
